Skip to content

test(health): cover dependency failure paths and HTTP status mapping - #187

Merged
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
temisan0x:test/health-check-deps
Mar 27, 2026
Merged

test(health): cover dependency failure paths and HTTP status mapping#187
greatest0fallt1me merged 2 commits into
CalloraOrg:mainfrom
temisan0x:test/health-check-deps

Conversation

@temisan0x

@temisan0x temisan0x commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Closes #130

Summary

This PR adds/cleans integration coverage for /api/health dependency-failure behavior and verifies HTTP status mapping.

What Changed

  • Refactored tests/integration/health.test.ts to remain integration-only (removed invalid pasted unit-test content).
  • Added/validated scenarios:
    • DB failure -> 503 + status: down
    • Optional dependency (Soroban/Horizon) failure -> 200 + status: degraded
    • Multiple optional failures with healthy DB -> 200 + status: degraded
    • No-config fallback -> status: ok, service: callora-backend
    • Sensitive error details are not exposed in response body
    • Health check completes within expected timing threshold

Additional CI-unblock Fixes

  • Resolved lint-blocking no-unsafe-declaration-merging issue in src/middleware/validate.ts.
  • Fixed IP allowlist logging/type usage and empty-allowlist fallback behavior in src/middleware/ipAllowlist.ts (+ related test import update).

Verification

  • npx prisma generate
  • npm run lint ✅ (0 errors, warnings remain)
  • npx jest --runInBand tests/integration/health.test.ts src/services/healthCheck.test.ts
    • Test Suites: 2 passed
    • Tests: 30 passed

CI Context

npm run typecheck is still failing on current upstream baseline files outside this ticket scope (for example src/config/env.ts, src/index.ts, src/events/event.emitter.test.ts, src/routes/billing.ts, etc.).
Health-check task coverage itself is implemented and validated via targeted test runs.

Security / Data Integrity Notes

  • Health responses remain safe for public exposure (no secrets leaked).
  • Added/kept assertion to ensure sensitive internal error text is not returned.
  • Dependency checks remain timeout-bounded to keep checks fast.

@drips-wave

drips-wave Bot commented Mar 27, 2026

Copy link
Copy Markdown

@temisan0x Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@temisan0x
temisan0x force-pushed the test/health-check-deps branch from 5c8a831 to c9a676b Compare March 27, 2026 17:14
@greatest0fallt1me
greatest0fallt1me merged commit ec02015 into CalloraOrg:main Mar 27, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Health: healthCheck service tests for dependency failures

2 participants